package com.yh.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.yh.entity.OrderInfo;
import com.yh.mapper.OrderMapper;
import com.yh.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderMapper orderMapper;

    @Override
    public void createOrder() {
        OrderInfo order = new OrderInfo();
        order.setOrderSn(System.currentTimeMillis()+"");
        orderMapper.insert(order);
    }

    @Override
    public OrderInfo getOrder(Long orderId) {

        return orderMapper.selectOne(new LambdaQueryWrapper<OrderInfo>().eq(OrderInfo::getId,orderId));
    }
}
